package name.sraynal.msgdispatcher.controller;

import name.sraynal.msgdispatcher.event.Event;
import name.sraynal.msgdispatcher.model.DispatcherModel;
import name.sraynal.msgdispatcher.view.FilesView;
import name.sraynal.msgdispatcher.view.TextView;

public class TextController extends Controller {

	private TextView textView;
	private FilesView filesView;

	public TextController(DispatcherModel model) {
		super(model);
	}

	@Override
	public void sendEvent(Event event) {
		if (event.getType() == Event.TEXT_WRITTEN) {
			model.text = this.textView.getText();
			displayView(this.filesView);
		} else if (event.getType() == Event.UNCONSISTANT_TEXT) {
			displayView(this.textView);
		}
	}

	public void setTextView(TextView textView) {
		this.textView = textView;
	}

	public void setFilesView(FilesView filesView) {
		this.filesView = filesView;
	}

}
